package com.headline.controller;

import com.headline.pojo.VO.portalSelectVO;
import com.headline.service.HeadlineService;
import com.headline.service.TypeService;
import com.headline.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/portal")
@Slf4j
public class portalController {
    @Autowired
    private TypeService typeService;

    @Autowired
    private HeadlineService headlineService;
    @GetMapping("/findAllTypes")
    public Result findAllTypes(){
        Result result = typeService.findAllTypes();
        return result;
    }
    @PostMapping("/findNewsPage")
    public Result findNewsPage(@RequestBody portalSelectVO portalSelectVO){
        log.info("搜索条件为：{}",portalSelectVO);
        Result result = headlineService.findNewsPage(portalSelectVO);
        return result;
    }

    @PostMapping("/showHeadlineDetail")
    public Result showHeadlineDetail(@Param("hid") Integer hid){
        Result result = headlineService.showHeadlineDetail(hid);
        return result;
    }
}
